package com.wenx.cxfCamel;

import org.apache.cxf.frontend.ClientProxyFactoryBean;

public class WebServiceClient {
    private static final String URL = "http://localhost:8080/camel/incident";

    protected static IncidentService createCXFClient() {
        // we use CXF to create a client for us as its easier than JAXWS and works
        ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
        factory.setServiceClass(IncidentService.class);
        factory.setAddress(URL);
        return (IncidentService) factory.create();
    }

    public static void main(String[] args) throws Exception {
        WebServiceClient client = new WebServiceClient();
        client.runTest();
    }

    protected void runTest() throws Exception {
        // create the webservice client and send the request
        IncidentService client = createCXFClient();
        String out = client.testHello("wen");
        System.out.println("sayHell输出"+out);
    }
}
